<template>
	<view class="">
		<view class="danger-box">
			<view class="danger-item" v-for="(item,index) in list" :key="index" @tap="jump(item)">
				<view class="safe" v-if="item.staffname">
					<image src="/static/aqy.png" mode=""></image>上传人：{{item.staffname}}
				</view>
				<view v-if="item.status == '1'">
					处理员工：<text v-for="i,idx in item.staffidsname" :key="idx">{{i}}
					<template v-if="item.staffidsname.length-1!=idx">
						、
					</template>
					</text>
				</view>
				<view>设备名称：{{item.equipment_name}}</view>
				<view>设备编号：{{item.equipment_number}}</view>
				<view v-if="item.status == '1'">上传日期：{{item.createtime}}</view>
				<view>隐患地址：{{item.address}}</view>
				<view>状<text class="kong"></text>态：
					<template v-if="item.status=='0'">
						未完成
					</template> 
					<template v-if="item.status=='1'">
						已完成
					</template>
					 
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				id:'',
				type:'',
				page:1,
				list:[]
			}
		},
		onShow(){
			this.list = []
			this.init()
		},
		onLoad(e) {
			this.id = e.id
			this.type = e.type
		},
		onReachBottom() {
			this.page ++ 
			this.init()
		},
		methods:{
			jump(i){
				let obj = JSON.stringify(i)
				if(i.status =='0'&&i.is_handel=='0') return	this.$showToast('您暂无处理权限')
				if(i.status =='3'&&i.is_handel=='1') return this.$navTo('./detalis?info='+obj)
				if(i.status !='0') return this.$navTo('./detalis?info='+obj)
				
			},
			init(){
				var _this = this
				uni.request({
					url: _this.$api+'equipment/getEquipmentInspectionList',
					method: 'POST',
					header:{
						token:uni.getStorageSync('token')
					},
					data: {
						page:_this.page,
						etype:_this.type,
						equipment_id:_this.id
					},
					success: res => {
						if(res.data.code==1){
							_this.list= _this.list.concat(res.data.data)
						}
					},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style lang="less" scoped>
	.content {
		padding-bottom: 140rpx;
		background: #F1F1F1;
		min-height: 100vh;
	}
	.danger-item {
		position: relative;
		box-sizing: border-box;
		width: 690rpx;
		padding: 30rpx;
		background-color: #fff;
		border-radius: 10rpx;
		margin: 30rpx auto 0;
		box-shadow: 0px 3px 4px rgba(0, 30, 57, 0.15);
	
		.safe {
			color: #003690;
			font-size: 28rpx;
			line-height: 38rpx;
	
			image {
				width: 36rpx;
				height: 36rpx;
				margin-right: 6rpx;
				vertical-align: bottom;
			}
		}
	
		.kong {
			display: inline-block;
			width: 56rpx;
		}
	
		.kong1 {
			display: inline-block;
			width: 14rpx;
		}
	
		.chaoshi_zhuantai {
			position: absolute;
			top: 20rpx;
			right: 20rpx;
			color: red;
			font-size: 28rpx;
			line-height: 38rpx;
		}
	
		.shenhe {
			position: absolute;
			top: 100rpx;
			right: 20rpx;
			width: 170rpx;
			height: 170rpx;
		}
	}
</style>
